const mongoose = require("mongoose")
const { getNowTime } = require("../utils/tools")
const RoleType = {
    rolename: {
        type: String,
        require: true
    }, // 角色名称
    sort: {
        type: Number,
        require: true
    }, // 排序
    status: {
        type: Boolean,
        required: true
    }, // 状态
    menus: [], // 菜单
    describe: String, // 描述
    createTime :{
        type:String,
        set() {
            return getNowTime()
        },
        default: getNowTime(),
        required: true,
    }

}

const schema = mongoose.Schema(RoleType)

const RoleModel = mongoose.model("role", schema)

module.exports = RoleModel